/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, {Component} from 'react';

import {
    StyleSheet,
    View,
    Text,
    Image,
    Dimensions,
    Button,
    Alert,
} from 'react-native';

var {height, width} = Dimensions.get('window');
export default class StartScreen extends Component {

    static navigationOptions = null

    constructor(props) {
        super(props)
        this.state = {
            text: ''
        };
    }

    componentDidMount(){
        var _this = this
        this.timer = setTimeout(
            () => {
                // console.log('把一个定时器的引用挂在this上');
                _this.toMainScreen();
            }
            ,2000
        );
    }

    componentWillUnmount(){
        this.timer && clearTimeout(this.timer)
    }

    toMainScreen(){
        // alert('把一个定时器的引用挂在this上');
        // this.props.navigation.navigate("MainScreenStack",{titleName:"主页"})
    }

    render() {

        const {navigate} = this.props.navigation

        return (
            <View style={styles.container}>
                {/*<Image source={require('../images/test_icon.jpg')} style={{width: width, height: height}}*/}
                       {/*onPress={console.log("控制台输出")}>*/}
                {/*</Image>*/}

                {
                    (<View>

                    </View>)
                }

                <Text style={styles.instructions}
                      onPress={()=>navigate("MainScreenStack",{titleName:"主页"})}
                >
                    kai qi ye mian
                </Text>

                <Button onPress={()=>navigate("MainScreenStack",{titleName:"主页"})}
                        title="进入首页"
                        style={styles.button}
                    >
                </Button>

                <Button onPress={()=>navigate("FlatListBasicsStack",{titleName:"List列表"})}
                        title="进入List列表"
                        style={styles.button}
                >
                </Button>
            </View>
        );

    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#F5FCFF',

    },
    button:{
        // width:this.width,
        // height:60,
        // justifyContent:'center',
        // alignItems:'center',
        marginTop:10,
        marginBottom:20,
        paddingTop:20,
        paddingBottom:20,
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        fontSize: 20,
        textAlign: 'center',
        color: '#333333',
        height: 60,
        marginBottom: 5,
    },
});
